package zbum.issue.issue.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import zbum.issue.issue.service.IssueService;
import zbum.issue.issue.service.IssueVO;
import zbum.issue.issue.service.SearchVO;
import egovframework.rte.fdl.cmmn.AbstractServiceImpl;
import egovframework.rte.fdl.idgnr.EgovIdGnrService;

/**
 * @Class Name : IssueServiceImpl.java
 * @Description : Issue Business Implement class
 * @Modification Information
 *
 * @author zbum
 * @since 2010-07-21
 * @version 1.0
 * @see
 *  
 *  Copyright (C)  All right reserved.
 */

@Service("issueService")
public class IssueServiceImpl extends AbstractServiceImpl implements
        IssueService {

    @Resource(name="issueDAO")
    private IssueDAO issueDAO;
    
    /** ID Generation */
    @Resource(name="egovIssueIdGnrService")    
    private EgovIdGnrService egovIdGnrService; 

	/**
	 * ISSUE을 등록한다.
	 * @param vo - 등록할 정보가 담긴 IssueVO
	 * @return 등록 결과
	 * @exception Exception
	 */
    public String insertIssue(IssueVO vo) throws Exception {
    	log.debug(vo.toString());
    	
    	/** ID Generation Service */
    	//TODO 해당 테이블 속성에 따라 ID 제너레이션 서비스 사용
    	String id = egovIdGnrService.getNextStringId();
    	vo.setId(id);
    	log.debug(vo.toString());
    	
    	issueDAO.insertIssue(vo);
    	//TODO 해당 테이블 정보에 맞게 수정    	
        return null;
    }

    /**
	 * ISSUE을 수정한다.
	 * @param vo - 수정할 정보가 담긴 IssueVO
	 * @return void형
	 * @exception Exception
	 */
    public void updateIssue(IssueVO vo) throws Exception {
        issueDAO.updateIssue(vo);
    }

    /**
	 * ISSUE을 삭제한다.
	 * @param vo - 삭제할 정보가 담긴 IssueVO
	 * @return void형 
	 * @exception Exception
	 */
    public void deleteIssue(IssueVO vo) throws Exception {
        issueDAO.deleteIssue(vo);
    }

    /**
	 * ISSUE을 조회한다.
	 * @param vo - 조회할 정보가 담긴 IssueVO
	 * @return 조회한 ISSUE
	 * @exception Exception
	 */
    public IssueVO selectIssue(IssueVO vo) throws Exception {
        IssueVO resultVO = issueDAO.selectIssue(vo);
        if (resultVO == null)
            throw processException("info.nodata.msg");
        return resultVO;
    }

    /**
	 * ISSUE 목록을 조회한다.
	 * @param searchVO - 조회할 정보가 담긴 VO
	 * @return ISSUE 목록
	 * @exception Exception
	 */
    public List selectIssueList(SearchVO searchVO) throws Exception {
        return issueDAO.selectIssueList(searchVO);
    }

    /**
	 * ISSUE 총 갯수를 조회한다.
	 * @param searchVO - 조회할 정보가 담긴 VO
	 * @return ISSUE 총 갯수
	 * @exception
	 */
    public int selectIssueListTotCnt(SearchVO searchVO) {
		return issueDAO.selectIssueListTotCnt(searchVO);
	}
    
}
